// 圆点图标
const circleSvg = (color = '#246FE5') => {
    const icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
<circle cx="8.43164" cy="7.59717" r="6" fill="${color}" stroke="white" stroke-width="3"/>
</svg>`;
    return icon;
};

// 位置图标
const locationSvg = (color = '#246FE5') => {
    const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
<g clip-path="url(#clip0_21611_223302)">
<path d="M23.7782 22.4451L16 30.2233L8.22178 22.4451C6.68342 20.9067 5.63578 18.9467 5.21136 16.8129C4.78693 14.6791 5.00478 12.4674 5.83734 10.4574C6.66991 8.44746 8.07981 6.72951 9.88875 5.52082C11.6977 4.31213 13.8244 3.66699 16 3.66699C18.1756 3.66699 20.3023 4.31213 22.1113 5.52082C23.9202 6.72951 25.3301 8.44746 26.1627 10.4574C26.9952 12.4674 27.2131 14.6791 26.7887 16.8129C26.3642 18.9467 25.3166 20.9067 23.7782 22.4451ZM16 18.3336C16.9725 18.3336 17.9051 17.9472 18.5927 17.2596C19.2804 16.572 19.6667 15.6393 19.6667 14.6669C19.6667 13.6944 19.2804 12.7618 18.5927 12.0742C17.9051 11.3865 16.9725 11.0002 16 11.0002C15.0275 11.0002 14.0949 11.3865 13.4073 12.0742C12.7196 12.7618 12.3333 13.6944 12.3333 14.6669C12.3333 15.6393 12.7196 16.572 13.4073 17.2596C14.0949 17.9472 15.0275 18.3336 16 18.3336Z" fill="${color}" stroke="white" stroke-width="2"/>
</g>
<defs>
<clipPath id="clip0_21611_223302">
<rect width="32" height="32" fill="white"/>
</clipPath>
</defs>
</svg>`;
    return svg;
};
// 图标转图片
const svgToImage = svg => {
    let result = encodeURIComponent(svg); // 转译
    result = 'data:image/svg+xml;utf8,' + result; // 添加url前缀
    result = 'image://' + result; // 添加ECharts需要的前缀
    return result;
};

// 圆点图片
export const circleImage = (color = '#246FE5') => {
    const svg = circleSvg(color);
    return svgToImage(svg);
};

// 位置图片
export const locationImage = (color = '#246FE5') => {
    const svg = locationSvg(color);
    return svgToImage(svg);
};
